package com.qf.sclg.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * Created with IntelliJ IDEA.
 * User: 吴绍坤
 * Date: 2021/10/13 9:43
 * Description:
 * Version: V1.0
 *
 */

@Configuration
public class CorsConfig implements WebMvcConfigurer {
    private static final String[] METHODS={"GET","POST","PUT","PATCH","DELETE"};

    @Override
    public void addCorsMappings(CorsRegistry registry) {
        registry.addMapping("/**")
                .allowedOriginPatterns("*")
                .allowedHeaders("*")
                .allowedMethods("METHODS")
                .allowCredentials(true)
                .maxAge(60);
    }//kuayucaozuo


}
